#pragma once
#include "pass.h"
#include <stdio.h>
#include "stdafx.h"

namespace aps {
#define CREATEDG_SUCCESS 	1
#define CREATEDG_FAILURE	0
#define ERROR_MEM_INSUF		-1
#define MRZ_SIZE	88

#define TAG_DG1		0x61
#define TAG_DG2		0x75
#define TAG_DG11	0x6B
#define TAG_DG12	0x6C
#define TAG_DG13	0x6D

#define TAG_MRZ		0x5F1F
#define TAG_LIST	0x5C
#define TAG_FULL_NAME		0x5F0E
#define TAG_BIOM_INFO_GROUP	0x7F61
#define TAG_BIOM_INFO_TEMP	0x7F60
#define TAG_BIOM_HEADER		0xA1
#define TAG_BIOM_TYPE		0x81
#define TAG_BIOM_FEAT		0x82
#define TAG_FORMAT_OWNER	0x87
#define TAG_FORMAT_TYPE		0x88	
#define TAG_BDB			0x5F2E
#define TAG_OTHER_NAME		0x5F0F
#define TAG_FULL_DOB		0x5F2B
#define TAG_PLACE_BIRTH		0x5F11
#define TAG_PERM_ADDRESS	0x5F42
#define TAG_ISSUE_AUTH		0x5F19
#define TAG_DATE_ISSUE		0x5F26
#define TAG_TIMESTAMP_PERSONAL	0x5F11
#define TAG_PLACE_ISSUE		0x80
#define TAG_FATHERS_NAME	0x81
#define	TAG_MOTHERS_NAME	0x82
#define TAG_SPOUSE_NAME		0x83
#define TAG_OLD_PASSPORT_NUM	0x84
#define TAG_OLD_PASSPORT_ISSUE	0x85
#define TAG_OLD_PASSPORT_DATE	0x86
#define TAG_FILE_NUMBER		0x87
#define TAG_CONTEXT_SPECIFIC_CONSTRUCTED 0xA0

static BYTE dtype[2] = {'P', '<'};
static BYTE country[3] = {'I', 'N', 'D'};
static BYTE optData[15] = {'<', '<', '<', '<', '<', '<', '<', '<', '<', '<', '<', '<', '<', '<', '0'};
static BYTE formatIdent[4] = {0x46, 0x41, 0x43, 0x00};
static BYTE version[4] = {0x30, 0x31, 0x30, 0x00};
static BYTE numFaces[2] = {0x00, 0x01};
static BYTE numFeat[2] = {0x00, 0x00};
static BYTE feats[14] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static BYTE imageType[1] = {0x02};
static BYTE dataType[1] = {0x00};
static BYTE imgSpecs[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static BYTE bty[1] = {0x02};
static BYTE bfe[1] = {0x00};
static BYTE fowner[2] = {0x01, 0x01};
static BYTE ftype[2] = {0x05, 0x01};
static BYTE num[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
static BYTE FULL_NAME[2] = {0x5F, 0x0E};
static BYTE CONTEXT_SPECIFIC_CONSTRUCTED[1] = {0xA0};
static BYTE PLACE_BIRTH[2] = {0x5F, 0x11};
static BYTE FULL_DOB[2] = {0x5F, 0x2B};
static BYTE PERM_ADDRESS[2] = {0x5F, 0x42};
static BYTE PLACE_ISSUE[1] = {0x80};
static BYTE FATHERS_NAME[1] = {0x81};
static BYTE MOTHERS_NAME[1] = {0x82};
static BYTE SPOUSE_NAME[1] = {0x83};
static BYTE OLD_PASSPORT[1] = {0xA0};
static BYTE FILE_NUMBER[1] = {0x87};
static BYTE ISSUE_AUTH[2] = {0x5F, 0x19};
static BYTE DATE_ISSUE[2] = {0x5F, 0x26};
static BYTE TIMESTAMP_PERSONAL[2] = {0x5F, 0x11};

int createDG1(const char* fileNo, BYTE* d, int len);
int createDG2(const char* fileNo, BYTE* d, int len);
int createDG11(const char* fileNo, BYTE* d, int len);
int createDG12(const char* fileNo, const char* address, BYTE* d, int len);
int createDG13(const char* fileNo, BYTE* d, int len);
}